<?php

declare(strict_types=1);

namespace App\Command;

use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Psr\Container\ContainerInterface;
use App\Service\CommodityService\SupplierCommodityKoreaPullLogService;
use App\Service\CommodityService\HmCommodityGoodsService;

/**
 * @Command
 * 韩国商品分类处理特殊逻辑
 */
class SupplierCommodityKoreGoodsClassTask extends HyperfCommand
{
    /**
     * @var ContainerInterface
     */
    protected $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;

        parent::__construct('SupplierCommodityKoreGoodsClassTask');
    }

    public function configure()
    {
        parent::configure();
        $this->setDescription('韩国商品分类处理特殊逻辑');
        $this->addArgument('supplierCode');
        $this->addArgument('field');
        $this->addArgument('pageSize');
    }

    public function handle()
    {
        $supplierCode = $this->input->getArgument('supplierCode');
        $field = $this->input->getArgument('field');
        $pageSzie = $this->input->getArgument('pageSize',10);
        $res = HmCommodityGoodsService::instance()->queryCommodityFieldList($supplierCode,$field,(int)$pageSzie);
        $this->line(json_encode($res,JSON_UNESCAPED_UNICODE), 'info');
    }
}
